<template>
  <div id="newsList">
    
    
    
    <div class="item" v-for="(item,index) in list" :key="index">
      <div class="author-img"><img :src="api+item.authorImgSrc" /></div>

      <div class="text">
        <div class="top">
          <div class="name">{{item.name}}</div>
          <div class="time">{{item.time}}</div>
        </div>
        <div class="content">{{item.content}}</div>
      </div>
    </div>


    <div class="more">没有更多了...</div>
    <div class="h-50"></div>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  name: 'newsList',
  data(){
    return{
      list:[],
      api:'http://127.0.0.1:8181/'
    }
  },
  mounted() {
    this.getUserList()
  },
  methods:{
    getUserList(){
      axios.get('api/userList.json')
    .then(this.getUserListSucc)
    },
    getUserListSucc(res){
      console.log(res)
      this.list = res.data.list
    }
    
  }
  
};
</script>

<style scoped>
  .h-50{
    height: 1rem;
  }
#newsList {
  background-color: #000000;
  margin-top: 0.2rem;
}
#newsList .item {
  height: 1.2rem;
  padding: 0.3rem 0.2rem;
  overflow: hidden;
}
#newsList .item .author-img {
  float: left;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  margin-left: 0.2rem;
}
#newsList .item .author-img img {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
}
#newsList .item .text {
  float: left;
  margin-left: 0.4rem;
  height: 1rem;
  width: 75%;
}
#newsList .item .text .top {
  height: 0.5rem;
  overflow: hidden;
}
#newsList .item .text .top .name {
  float: left;
  font-size: 0.35rem;
  color: #ffffff;
}
#newsList .item .text .top .time {
  float: right;
  font-size: 0.25rem;
  color: #aaa;
}
#newsList .item .text .content {
  height: 0.5rem;
  line-height: 0.5rem;
  font-size: 0.3rem;
  color: #aaa;
}
#newsList .more{
  width: 100%;
  height: 1rem;
  line-height: 1rem;
  color: #aaa;
  font-size: .3rem;
  text-align: center;
}
</style>
